{% extends 'layout.html' %}

{% block main %}
<div class="d-flex justify-content-center mt-4">
    <div class="col-md-4">
        {% for message in messages %}
        <div class="alert {% if message.tags == 'success' %} alert-success {% else %} alert-warning {% endif %} alert-dismissible fade show"
            role="alert">
            {{ message }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
        {% endfor %}
        <form action="{% url 'login' %}" method="post">
            {% csrf_token %}
            <div class="form-group">
                {{ form.username.errors }}
                <label for="{{ form.username.id_for_label }}" class="mb-2">用户名:</label>
                {{ form.username }}
            </div>
            <div class="form-group">
                {{ form.password.errors }}
                <label for="{{ form.password.id_for_label }}" class="my-2">密码:</label>
                {{ form.password }}
            </div>
            <div class="form-group mt-4">
                <button class="btn btn-secondary" type="submit">登录</button>
            </div>
        </form>
    </div>
</div>
{% endblock %}